<?php
		require_once('Snoopy.class.php');
		$apikey = 'ABQIAAAAw1SSDc7JV6sSVqFi6ucGqRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTJonmeyVrw3UZEy-kupSao5fh51g';
		$file = 'http://maps.google.com/maps/geo?q='.$_GET['adresse'].' '.$_GET['cp'].' '.$_GET['ville'].'&output=xml&key='.$_GET['key'];
		$file = 'http://maps.google.com/maps/geo?q='.$_GET['q'].'&output='.$_GET['output'].'&key='.$_GET['key'];
		if (isset($_GET['q'])):
			//echo '<a href="'.$file.'">link</a>';
			$snoopy = new Snoopy;
			$snoopy->agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'; // browser
			$snoopy->fetch($file);
			$snoopy->referer = ""; // referer
			$snoopy->cookies["SessionID"] = ''; // cookies' vars
			
			// set some internal variables:
			$snoopy->maxredirs = 2;
			$snoopy->offsiteok = false;
			$snoopy->expandlinks = false;
			 
			// fetch the text of the website www.google.com:
			if($snoopy->fetch($file)){ 
				$xml = new SimpleXMLElement($snoopy->results);
				$coord = explode(',', $xml->Response[0]->Placemark[0]->Point[0]->coordinates[0]); // "So this language. It's like..."
				//echo $coord[0].'<br/>'.$coord[1];
				header("Content-type: text/xml");
				echo $snoopy->results;
			//*/
			}	else {
			    header("Status : 500");
			}
		endif;
